import { ajaxGet } from '@/util'
export default ({
  state: {
    rimList: [],
    brandList: []
  },
  actions: {
    getRimData({ commit, dispatch, state }) {
      ajaxGet(`/common/rim/list`).then(data => {
        state.rimList = data.map((item, index) => {
          return {
            id: `${index}`,
            label: item
          } 
        })
      })
    },
    getBrandData({commit, dispatch, state}) {
      ajaxGet(`/common/brand/list`).then(data => {
        state.brandList = data.map((item) => {
          return {
            id: item.id,
            label: item.name
          }
        })
      })
    }
  },
  getters: {
    rimList: (state) => state.rimList,
    TyrebrandList: (state) => state.brandList
  }
})